package com.ssh.demo.main.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ssh.demo.base.action.BaseAction;
import com.ssh.demo.main.common.bean.Admin;
import com.ssh.demo.main.common.bean.TestBean;
import com.ssh.demo.main.common.dao.TestDao;
import com.ssh.demo.main.common.service.TestService;

/**
 * 测试
 * 
 * @author kai
 *
 */
@Component("testAction")
public class TestAction extends BaseAction {

	private TestBean testBean;

	@Resource(name = "testService")
	private TestService testService;

	private TestDao testDao;

	public TestDao getTestDao() {
		return testDao;
	}

	public void setTestDao(TestDao testDao) {
		this.testDao = testDao;
	}

	public TestService getTestService() {

		return testService;
	}

	public void setTestService(TestService testService) {
		this.testService = testService;
	}

	public TestAction() {
		super();
		log.info("===>TestAction");
		log.info("====>"+new Admin());
	}

	private static final long serialVersionUID = 1L;

	public String execute() {
		try {
			log.info("abccc");
			List<TestBean> list = testService.findAll();
			// log.info("jk==>"+list.get(0).getTitle());
			log.info("list==>" + list.toString());
			TestBean t = new TestBean();
			t.setTitle("biaoti");
			t.setContent("neirong");
			testService.saveOrUpdate(t);
			System.out.println("==============");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("发生错误" + e.getLocalizedMessage());
			e.printStackTrace();
		}
		return SUCCESS;
	}

}
